"""
Stock data models for the stock data display system.
"""
from dataclasses import dataclass
from typing import Optional


@dataclass
class StockInfo:
    """扩展的股票基本信息数据模型"""
    # 基本信息
    code: str
    name: str
    industry: str
    list_date: str
    market: str
    data_source: str
    
    # 价格信息
    current_price: Optional[float] = None
    change_amount: Optional[float] = None
    change_percent: Optional[float] = None
    
    # 股本信息
    total_shares: Optional[int] = None
    float_shares: Optional[int] = None
    
    # 市值信息
    total_market_cap: Optional[float] = None
    float_market_cap: Optional[float] = None
    
    # 交易信息
    volume: Optional[int] = None
    
    # 元数据
    update_time: Optional[str] = None


@dataclass
class StockData:
    """股票历史数据模型"""
    date: str
    open: float
    high: float
    low: float
    close: float
    volume: int
    amount: float
    data_source: str


@dataclass
class DataSourceConfig:
    """数据源配置模型"""
    primary_source: str = "akshare"
    fallback_source: str = "akshare"  # 当前只支持akshare数据源
    timeout: int = 30
    retry_count: int = 3